//
//  NSDictionary.swift
//  vr_web
//
//  Created by 李旭峰 on 2020/7/13.
//

import Foundation

extension NSDictionary {
    func jsonString()->String?{
        let tempDict = self
        if !JSONSerialization.isValidJSONObject(tempDict) {
            return nil
        }
        let jsonData = try? JSONSerialization.data(withJSONObject: tempDict, options: [])
        guard let tempData = jsonData else {
            return nil
        }
        let jsonString = String(data: tempData, encoding: .utf8)
        return jsonString
    }
}
